from selenium.webdriver.support.wait import WebDriverWait


def find_element(wd,find_type,expression):
    '''
    封装查找单个元素
    :param wd:
    :param find_type:
    :param expression:
    :return:
    '''
    try:
        element = WebDriverWait(wd,20).until(lambda wd:wd.find_element(find_type,expression))
        return element
    except Exception as e:
        print(e)

def find_elements(wd,find_type,expression):
    '''
    封装查找多个元素种的一个元素
    :param wd:
    :param find_type:
    :param expression:
    :return:
    '''
    try:
        elements = WebDriverWait(wd,20).until(lambda wd:wd.find_elements(find_type,expression))
        return elements
    except Exception as e:
        print(e)
